//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Windows.Data;

namespace OpenLS.Chart.UI
{
    class ForceUnitConverter: IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
                return new CustomUnit();
            return value;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            CustomUnit u = value as CustomUnit;
            if (u != null && u.Value == 1)
                return null;
            return value;
        }

        #endregion
    }
}
